﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using HGZP.BLL;
using HGZP.DAL;
using HGZP.Model;
using HGZP.PLL;
using System.Data;

namespace SZCB.admin.EnterpriseManager
{
    public partial class AddProductClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            CProductClassBLL myCProductClassBLL = new CProductClassBLL();
            DataTable dt = myCProductClassBLL.F02_SelectHaveWhere("sName = '" + txtName.Text + "'");
            if (dt.Rows.Count > 0)
            {
                string strErrmessage = "该类型已添加";
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + strErrmessage + "');</script>");
                return;
            }

            CProductClass myCProductClass = new CProductClass();
            myCProductClass.sGuid = MyFunction.GetNewGuid();
            myCProductClass.sName = txtName.Text;

            if (!myCProductClassBLL.F_Insert(myCProductClass))
            {
                string strErrmessage = "添加类型失败";
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + strErrmessage + "');</script>");
                return;
            }


        }

    }
}